#include <stdio.h>
#include <math.h>
#include <stdlib.h>

enum bb_code
{
  bb_none,
  bb_comma,
  bb_embedded_comment_start,
  bb_embedded_comment_end,
  bb_proc_call,
  bb_dec_ind,
  bb_unary_op,
  bb_binary_op,
  bb_before_boolean_binary_op,
  bb_after_boolean_binary_op,
  bb_after_equal_sign,
  bb_comparisation,
  bb_question,
  bb_colon,
  bb_label,
  bb_semicolon,
  bb_lbrace,
  bb_rbrace,
  bb_overloaded,
  bb_const_qualifier,
  bb_ident,
  bb_attribute,
  bb_struct_delim,
  bb_operator2,			/* member selection (bb_struct_delim `.' or `->') */
  bb_operator4,			/* member selection (bb_struct_delim `.*' or `->*') */
  bb_operator5,			/* multiply, divide or modulo */
  bb_operator6,			/* add or subtract */
  bb_doublecolon,
  bb_cast
}

struct parser_state
{
  struct parser_state *next;
  enum codes last_token;

  /* This is the parsers stack, and the current allocated size.  */
  enum codes *p_stack;
  int p_stack_size;

  /* This stack stores indentation levels */
  /* Currently allocated size is stored in p_stack_size.  */
  int *il;

  /* If the last token was an ident and is a reserved word,
     remember the type. */
  enum rwcodes last_rw;

  /* also, remember its depth in parentheses */
  int last_rw_depth;

  /* Used to store case stmt indentation levels.  */
  /* Currently allocated size is stored in p_stack_size.  */
  int *cstk;

  /* Pointer to the top of stack of the p_stack, il and cstk arrays. */
  int tos;

  int box_com;			/* set to true when we are in a
				   "boxed" comment. In that case, the
				   first non-blank char should be
				   lined up with the / in the comment
				   closing delimiter */

  int cast_mask;		/* indicates which close parens close off
				   casts */
  /* A bit for each paren level, set if the open paren was in a context which
     indicates that this pair of parentheses is not a cast.  */
  int noncast_mask;

  int sizeof_mask;		/* indicates which close parens close off
				   sizeof''s */
  int block_init;		/* set to 1 if inside a block initialization
				   set to 2 if inside an enum declaration */
  int block_init_level;		/* The level of brace nesting in an
				   initialization (0 in an enum decl) */
  int last_nl;			/* this is true if the last thing scanned was
				   a newline */
  int last_saw_nl;		/* this is true if the last non white space
				   scanned was a newline */
  int saw_double_colon;		/* set when we see a ::, reset at first semi-
				   colon or left brace */
  int broken_at_non_nl;		/* true when a line was broken at a place
				   where there was no newline in the input file */
  int in_or_st;			/* Will be true iff there has been a
				   declarator (e.g. int or char) and no left
				   paren since the last semicolon. When true,
				   a '{' is starting a structure definition
				   or an initialization list */
  int bl_line;			/* set to 1 by dump_line if the line is
				   blank */
  int col_1;			/* set to true if the last token started in
				   column 1 */
  int com_col;			/* this is the column in which the current
				   coment should start */
  int dec_nest;			/* current nesting level for structure or
				   init */
  int decl_on_line;		/* set to true if this line of code has part
				   of a declaration on it */
  int i_l_follow;		/* the level in spaces to which ind_level
				   should be set after the current line is
				   printed */
  int in_decl;			/* set to true when we are in a declaration
				   stmt.  The processing of braces is then
				   slightly different */
  int in_stmt;			/* set to 1 while in a stmt */
  int ind_level;		/* the current indentation level in spaces */
  int ind_stmt;			/* set to 1 if next line should have an extra
				   indentation level because we are in the
				   middle of a stmt */
  int last_u_d;			/* set to true after scanning a token which
				   forces a following operator to be unary */
  int p_l_follow;		/* used to remember how to indent following
				   statement */
  int paren_level;		/* parenthesization level. used to indent
				   within stmts */
  int paren_depth;		/* Depth of paren nesting anywhere. */
  /* Column positions of paren at each level.  If positive, it contains just
     the number of characters of code on the line up to and including the
     right parenthesis character.  If negative, it contains the opposite of
     the actual level of indentation in characters (that is, the indentation
     of the line has been added to the number of characters and the sign has
     been reversed to indicate that this has been done).  */
  short *paren_indents;		/* column positions of each paren */
  int paren_indents_size;	/* Currently allocated size.  */

  int pcase;			/* set to 1 if the current line label is a
				   case.  It is printed differently from a
				   regular label */
  int search_brace;		/* set to true by parse when it is necessary
				   to buffer up all info up to the start of a
				   stmt after an if, while, etc */
  int use_ff;			/* set to one if the current line should be
				   terminated with a form feed */
  int want_blank;		/* set to true when the following token
				   should be prefixed by a blank. (Said
				   prefixing is ignored in some cases.) */
  enum bb_code can_break;	/* set when a break is ok before the following
				   token (is automatically implied by
				   `want_blank'. */
  int its_a_keyword;
  int sizeof_keyword;
  int dumped_decl_indent;
  int in_parameter_declaration;
  char *procname;		/* The name of the current procedure */
  char *procname_end;		/* One char past the last one in procname */
  char *classname;		/* The name of the current C++ class */
  char *classname_end;		/* One char past the last one in classname */
  int just_saw_decl;
  int matching_brace_on_same_line;	/* Set to a value >= 0 if the the
					   current '}' has a matching '{'
					   on the same input line */
};


int main(int argc,char **argv)
{
  
  return 0;
}
